package com.xxxx.source_operator;


import org.apache.flink.api.common.functions.FilterFunction;
import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.util.Collector;


/**
 * @program: flink19Test
 * @description:
 * @author: CoreDao
 * @create: 2021-04-01 14:48
 **/

public class Source_generateSequence {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        env.setParallelism(1);

        DataStreamSource<Long> dataStreamSource = env.generateSequence(0,100);

        dataStreamSource.filter(new FilterFunction<Long>() {
            @Override
            public boolean filter(Long value) throws Exception {
                return value % 5 == 0;
            }
        }).print();

        System.out.println(env.getExecutionPlan());
        env.execute();
    }

}
